package com.yape.controller;

import com.yape.stockService.IStockNewsService;
import com.yape.response.Response;
import com.yape.vo.StockNewsVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yape
 * @description
 * @date 2025/5/24 22:18
 */
@RestController
@RequestMapping("/api/news/")
@CrossOrigin("*")
@Slf4j
public class StockNewsController {

    @Resource
    private IStockNewsService stockNewsService;

    @GetMapping("flashes")
    public Response<List<StockNewsVO>> getStockNews() {
        log.info("获取证券快讯");
        List<StockNewsVO> stockNewsVOS = stockNewsService.queryStockNews();

        return Response.<List<StockNewsVO>>builder()
                .code("200")
                .message("success")
                .data(stockNewsVOS)
                .build();
    }
}
